{include file="public/nheader" /}
<div class="layui-fluid">
    <div class="layui-card" id="LAY_demo1">
        <!-- // 创建数据实例 -->
        <!-- <table id="lay-tableList" lay-filter="lay-tableList"></table> -->
    </div>
</div>
{include file="public/nfooter"}
<script>
    layui.use('flow', function () {
        var flow = layui.flow;
        flow.load({
            elem: '#LAY_demo1' //流加载容器
            , done: function (page, next) {
                //执行下一页的回调
                $.ajax({
                    url: "{:url()}",
                    type: 'post',
                    data: { "page": page,user_id: "{:input('user_id/d',0)}"},
                    success: function (res) {
                        if (res.code == 200) {
                            var lis = [];
                            //假设你的列表返回在data集合中
                            layui.each(res.data, function (index, value) {
                                var str = '<div class="layui-col-md12 layui-col-sm4 layui-fluid "style="background-color: #d6e6f5;border-bottom:1px solid #fff;border-right:1px solid #fff;"><div class="caller-main caller-fl"><p>交易金额:' + value.money + '</p><p>交易时间:' + value.created + '</p><p>备注说明:' + value.info + '</p></div></div>';
                                lis.push(str);
                            });
                            //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                            next(lis.join(''), page < res.data.length);
                        }
                    }
                });
            }
        });
    });
</script>
<script>
    layui.use(['table'], function () {
        var table = layui.table;
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList",
            where: {
                user_id: "{:input('user_id/d',0)}"
            }
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , even: true
            , cols: [[
                { field: 'id', align: 'center', sort: true, width: 80, title: 'ID' },
                { field: 'befores', width: 150, align: 'center', title: '交易前金额' },
                { field: 'money', width: 150, align: 'center', title: '交易金额' },
                { field: 'after', width: 150, align: 'center', title: '交易后金额' },
                { field: 'info', width: 150, align: 'center', title: '备注' },
                // { field: 'source', width: 150, align: 'center', title: '来自订单ID' },
                { field: 'created', width: 200, align: 'center', title: '添加时间' },
            ]]
        })
    })
</script>
</body>